import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		BufferedReader br;
		String line = "";
		Calc RPNCalculator = new Calc();
		
		
		
		/* elad will enter it to a function that returns string */
		
		try {
			br = new BufferedReader(new FileReader(args[0]));
		} catch (Exception e) {
			System.err.println(e);
			return;
		}
		
		
		/* we don't know why we can't do this in while loop 
		 * also close file
		 * handle .
		 * get top element not good (returns -1)
		 * brackets
		 */
		
		try {
			while((line = br.readLine()) != null)
			{
				if(!line.isEmpty()) {
					line += " : " + RPNCalculator.process(line);
					System.out.println(line);
				}
			}
		} catch (Exception e) {
			System.err.println(e);
		}
		
		try {
			br.close();
		} catch (IOException e) {
			System.err.println(e);
		}
	}

}
